const { CleanWebpackPlugin } = require('clean-webpack-plugin')

module.exports = {
    entry: './src/index.ts',
    output: {
      filename: 'sdk.js'
    },
    resolve: {
      extensions: ['.js', 'ts', 'tsx']
    },
    module: {
      // 配置以.ts/.tsx结尾的文件都用ts-loader解析
      rules: [
        {
          test: /\.tsx?$/,
          use: 'ts-loader',
          exclude: /node_modules/
        }
      ]
    },
    plugins: [
      new CleanWebpackPlugin({
        cleanOnceBeforeBuildPatterns: ['./dist']
      })
    ]
  }